#include "../../../xcom/xall.hpp"

int main(int argc, char* argv[])
{
    // 关闭错误printf
    _xxx_printf = false;

    const char* ip = argv[1];
    port_t port = atoi(argv[2]);
    
    xsock s;
    bool ret = s.tcp_create();
    X_CHECK(ret,-1);

    while(1){
        ret = s.connect(ip,port);
        if(ret){
            auto peer = s.get_peer_addr();
            auto local = s.get_local_addr();
            printf("connected！peer=%s,local=%s\n",
                get_addr_str(&peer).c_str(),
                get_addr_str(&local).c_str()
                );
            sleep_ns((uint64_t)200*1000*1000*1000);

            break;
        }
    }
    
    return 0;
}